package ru.ssau.university.web.helper;

import java.util.List;

import javax.faces.component.html.HtmlDataTable;

import ru.ssau.university.persistence.entity.CommonEntity;

public class ListWrapper<T extends CommonEntity> {
	private Long id;
	private List<T> items;
	private T currentItem;
	private HtmlDataTable dataTable;
	
	public String getStyle() {
		@SuppressWarnings("unchecked")
		T item = (T) dataTable.getRowData(); 
		if (item.getId() == id) {
			return "choosed";
		} else {
			return "";
		}
	}
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public List<T> getItems() {
		return items;
	}

	public void setItems(List<T> items) {
		this.items = items;
	}

	public T getCurrentItem() {
		return currentItem;
	}

	public void setCurrentItem(T currentItem) {
		this.currentItem = currentItem;
	}

	public HtmlDataTable getDataTable() {
		return dataTable;
	}

	public void setDataTable(HtmlDataTable dataTable) {
		this.dataTable = dataTable;
	}
}
